<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page language="java" import="com.tjtt.common.utils.DateUtilsAll"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String mainid = request.getParameter("mainid");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">   
<html>
  <head>
    <base target="_self"/>
	<%@ include file="../jslib/jquerylib.jsp" %> 
	<link rel="stylesheet" type="text/css" href="<%=path %>/web/style/layout.css" />
    <script type="text/javascript" src="<%=path %>/jslib/jquery.validate.min.js"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/My97DatePicker/WdatePicker.js"  defer="defer"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/jquery.form.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath() %>/jslib/additional-methods.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/default/easyui.css" />
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/icon.css" />
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/demo.css" />
	<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/lhgdialog/lhgcore.lhgdialog.min.js?skin=mac"></script>
    <c:if test="${requestScope.message!=null}">
		<script type="text/javascript">
 	 		     alert('<c:out value="${requestScope.message}"></c:out>');
 	 		     window.close();
 		</script>
	</c:if>
	<style type="text/css">
 		body{
 			background:#ffffff; background-image:url(images/);
 			
 		}
   		html{
		    overflow-x: hidden;
			overflow-y: auto;
		}  	
		.formTableNew textarea{border: 1px solid #999;padding: 5px;width: 760px;-moz-border-radius: 3px;border-radius: 3px;margin-bottom: 5px;color: #666;background: url(../images/input_bg.gif) repeat-x top;}
   </style>	
 
  	<script type="text/javascript">
  		var api = frameElement.api, W = api.opener;
    	var stateValue="";
		var appid="${requestScope.id }";
   		$(document).ready(function(){
			var options = {
		  	    url:"<%=request.getContextPath() %>/shebeiguzhangAction!GuzhangFlowFaqi.action",
		  	     beforeSubmit: function() {
		   				return checking();
		    			},
		  	    dataType:'json',
		  	    success: function(data) {
		  	    //alert(data);
		  	      if(data.result=='success'){
					alert("提交成功");
				//	window.close();
					api.close();
					W.reload();
		  	      }
		  	    }};
		$('#saveBtn').click(function(){
			    	$('#pageFrom').ajaxSubmit(options);
	 	            return false;
    	 });
    	$('#closeBtn').click(function(){
    		api.close();
			//window.close();
		});									
	}); 
	
	function checking(){
		var lianxifangshi = $("#lianxifangshi").val();
		var baoxiubumen = $("#baoxiubumen").val();
		var baoxiuren = $("#baoxiuren").val();
		var guzhangtime = $("#guzhangtime").val();
		var guzhangmiaoshu = $("#guzhangmiaoshu").val();
		var shebeistate = $("#shebeistate").val();
		var guzhangtime = $("#guzhangtime").val();
		if(lianxifangshi ==null || lianxifangshi == "" ){
				alert("联系方式不能为空！");
				$("#lianxifangshi").focus();
	    		return false;
			}
			if(guzhangtime ==null || guzhangtime == "" ){
				alert("故障时间不能为空！");
				$("#guzhangtime").focus();
	    		return false;
			}
			if(baoxiubumen ==null || baoxiubumen == "" ){
				alert("保修部门不能为空");
				$("#baoxiubumen").focus();
	    		return false;
			}
			if(baoxiuren ==null || baoxiuren == "" ){
				alert("保修人不能为空！");
				$("#baoxiuren").focus();
	    		return false;
			}
			if(guzhangtime ==null || guzhangtime == "" ){
				alert("故障时间不能为空！");
				$("#guzhangtime").focus();
	    		return false;
			}
			if(guzhangmiaoshu ==null || guzhangmiaoshu == "" ){
				alert("故障描述不能为空");
				$("#guzhangmiaoshu").focus();
	    		return false;
			}
			if(shebeistate ==null || shebeistate == "" ){
				alert("设备状态不能为空！");
				$("#shebeistate").focus();
	    		return false;
			}
			
	}
	
	
	  //选择设备台账
	function selectEqu(){
		var datas = window.showModalDialog("<%=request.getContextPath() %>/view/shebeiguzhang_choosesb.jsp?temp="+Math.round(Math.random()*10000),'',"dialogWidth=900px;dialogHeight=550px");
		if(typeof(datas) == 'undefined'){
		}else{
			var json1 = eval('(' + datas + ')');
			 document.getElementById("EQUIPMENT_NAME").value = json1.EQUIPMENT_NAME;
			 document.getElementById("equipmentId").value = json1.id;
			 document.getElementById("EQUIPMENT_NO").value = json1.EQUIPMENT_NO;
			 document.getElementById("EQU_GUGE").value = json1.EQU_GUGE;
			 document.getElementById("EQU_GJ_DATE").value = json1.EQU_GJ_DATE;
			 document.getElementById("EQUIPMENT_SCCJ").value = json1.EQUIPMENT_SCCJ;
			 document.getElementById("EQUIPMENT_GJYFSB").value = json1.EQUIPMENT_GJYFSB;
			 document.getElementById("EQUIPMENT_JKSB").value = json1.EQUIPMENT_JKSB;
			 document.getElementById("EQUIPMENT_JSX").value = json1.EQUIPMENT_JSX;
		}
	}
	
  	</script>
   </head>
  <body>
    <form id="pageFrom" action="" enctype="multipart/form-data" method="post">
    	 <input type="hidden" id="flag" name="flag" />
        <input type="hidden" name="flowid" id="flowid" value="${flowid}" />
     	<input type="hidden" name="stateid" id="stateid" value="${stateid}" />
     	<input type="hidden" id="guzhangid" name="guzhangid" value="${requestScope.id}" />
  		<table width="100%" border="0" align="center" cellpadding="5" cellspacing="5" class="formTableNew" style="padding-top: 20px">
  			 <tr>
			  <td align="right" style="width:80px">流程名称:</td>
     		<td align="left">
     		<input type="text" id="flowname" name="flowname" maxlength="50" value="设备故障流程" style="border: 1px solid #999;padding: 5px;width:250px;"/>
     		<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img></td>
     		<td align="right">设备名称:</td>
  			  <td align="left">
  			  	<input type="hidden" id="equipmentId" name="equipmentId" value=""/>
  			  	 <input  type="text"  id="EQUIPMENT_NAME" maxlength="50"  name="EQUIPMENT_NAME" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="" />
  			     <img src="<%=request.getContextPath() %>/images/xh.png"  align="absmiddle"></img>
  			    <img src="<%=request.getContextPath() %>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectEqu()" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">设备编号：</td>
  			  <td align="left">
  			    <input  type="text" id="EQUIPMENT_NO" maxlength="50" name="EQUIPMENT_NO" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="" />
  			  </td>
  			  <td align="right">规格型号：</td>
  			  <td align="left">
  			    <input  type="text" id="EQU_GUGE" maxlength="50" name="EQU_GUGE" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">购进日期：</td>
  			  <td align="left">
  			    <input  type="text" id="EQU_GJ_DATE" maxlength="50" name="EQU_GJ_DATE" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="" />
  			  </td>
  			  <td align="right">厂家名称：</td>
  			  <td align="left">
  			    <input  type="text" id="EQUIPMENT_SCCJ" maxlength="50" name="EQUIPMENT_SCCJ" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">关键研发设备：</td>
  			  <td align="left">
  			    <input  type="text" id="EQUIPMENT_GJYFSB" maxlength="50" name="EQUIPMENT_GJYFSB" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="" />
  			  </td>
  			  <td align="right">进口设备：</td>
  			  <td align="left">
  			    <input  type="text" id="EQUIPMENT_JKSB" maxlength="50" name="EQUIPMENT_JKSB" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">机损险：</td>
  			  <td align="left">
  			    <input  type="text" id="EQUIPMENT_JSX" maxlength="50" name="EQUIPMENT_JSX" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="" />
  			  </td>
  			  <td align="right">报修部门：</td>
  			  <td align="left">
  			    <input  type="text" id="baoxiubumen" maxlength="50" name="baoxiubumen" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="<%=session.getAttribute("ORG_NAME") %>"/>
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">报修人：</td>
  			  <td align="left">
  			  	<input type="hidden" id="baoxiurenid" name="baoxiurenid" value="<%=session.getAttribute("TDM_USER_ID") %>"/>
  			    <input  type="text" id="baoxiuren" maxlength="50" name="baoxiuren" style="border: 1px solid #999;padding: 5px;width: 250px;" value="<%=session.getAttribute("username") %>" />
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			  <td align="right">联系方式：</td>
  			  <td align="left">
  			    <input  type="text" id="lianxifangshi" maxlength="50" name="lianxifangshi" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="" />
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">故障时间：</td>
  			  <td align="left">
  			    <input  type="text" id="guzhangtime" maxlength="50" name="guzhangtime" onChange="changeDate()" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});"  style="border: 1px solid #999;padding: 5px;width: 250px;"  value="" />
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			  <td align="right">是否保质期：</td>
  			  <td align="left">
  			    <input  type="radio" name="shifoubaozhi"  value="是" />是
	  			<input  type="radio" name="shifoubaozhi"  value="否" />否
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">设备状态更改：</td>
  			  <td align="left">
  			    <input  type="text" id="shebeistate" maxlength="50" name="shebeistate" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="" />
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			  <td align="right">故障描述：</td>
  			  <td align="left">
  			    <input  type="text" id="guzhangmiaoshu" maxlength="50" name="guzhangmiaoshu" style="border: 1px solid #999;padding: 5px;width: 250px;"  value="" />
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right" style="width:150px">附件：</td>
  			  <td align="left" colspan="3">
  			  	<jsp:include page="../fileupload/attachment.jsp?id=${requestScope.id }&column=fujian&show=n" ></jsp:include>
  			  </td>
  			</tr>
            <tr>   
			<td align="center" colspan="4">
		    	<input id="saveBtn" type="button" value="提 交"  class="form_bt_orange" />
		    	<input type="button" id="closeBtn" value="取 消" class="form_bt_grey" />
		    </td>
		  </tr>
		</table>
	<!--表单结束-->
	</form>
  </body>
</html>
